﻿
using OABLL;
using OAModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace MyOA
{
    public partial class zcsq2 : Form
    {
        baoxiaobll bll = new baoxiaobll();  

        public string _yuangongid = string.Empty;
        public string _Oa报销单号 = string.Empty;
        public zcsq2(string Oa报销单号, string oa)
        {
            InitializeComponent();
            this._yuangongid = oa;
            this._Oa报销单号 = Oa报销单号;


        }

        private void btn报销提交_Click(object sender, EventArgs e)
        {

            BaoxiaoEntity bx = new BaoxiaoEntity();



            bx.Oa员工id = lblid.Text;
            bx.Oa员工姓名 = lblxm.Text;
            //在代码获取日期前添加此代码 设置日期格式 然后new DateTime 完美解决
            CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd HH:mm:ss";
            culture.DateTimeFormat.LongTimePattern = ""; Thread.CurrentThread.CurrentCulture = culture;
            bx.Oa报销时间 = DateTime.Parse(dt时间.Value.ToString());
            bx.Oa金额 = tx报销金额.Text.Trim();
            bx.Oa报销内容 = tx报销内容.Text.Trim();

            bool b1 = bll.upqingjia(_Oa报销单号, bx);
            if (b1 == true)
            {
                MessageBox.Show("提交申请成功，等待审批中！");

            }
            else
            {
                MessageBox.Show("提交失败，请稍后重试！");
            }

        }


        //加载页面信息
        private void zcsq2_Load(object sender, EventArgs e)
        {
            OAUseEntity user = new OAUseBLL().Getyuangong(_yuangongid);
            this.lblid.Text = user.Oa员工id;
            this.lblxm.Text = user.Oa姓名;
        }
    }
}
